<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    let arr = [112, 22, [33, 45, [55, 65],
        [58, 89]
    ]]

    let result = []
    // result = Array.prototype.concat.apply([], arr)
    // console.log(result);

    // arr += ''
    // console.log(arr);
    // arr = arr.split(',')
    // console.log(arr);

    // console.log(arr.flat(Infinity));
    // function flats(arr) {
    //     let newArr = []
    //     for (var i of arr) {
    //         if (Array.isArray(i)) {
    //             newArr.push.apply(newArr, flats(i))
    //         } else {
    //             newArr.push(i)
    //             console.log('---', i, '---', newArr);
    //         }
    //     }
    //     return newArr
    // }
    let newArr = []

    function flats(arr) {
        if (arr == null) {
            return arr
        }
        arr.forEach(item => {
            if (Array.isArray(item)) {
                flats(item)
            } else {
                newArr.push(item)
            }
        });
    }
    // flats(arr)
    // console.log(newArr);



    let str = JSON.stringify(arr)
    let str2 = str.replace(/\[|\]/g, '')
    str2 = '[' + str2 + ']'
    // console.log(JSON.parse(str2));



    let ooo = '1233321'
    let oo = ooo.split('').reverse().join('')
    // console.log(oo == ooo);

    function isPalind(str) {
        if (str.length <= 1) return true

        str = str.toLowerCase()
        console.log('---', str);
        let strlstart = str[0]
        let strlend = str[str.length - 1]
        if (strlstart == strlend) {
            isPalind(str.splice(1, str.length - 1))
        } else {
            return false
        }

    }
    isPalind(str)
    console.log(isPalind(str));
</script>

</html>